.class public Lcom/netease/mobistat/client/clients/StatClient;
.super Lcom/netease/mobistat/client/clients/BaseClient;
.source "StatClient.java"


# direct methods
.method public constructor <init>()V
    .locals 2

    .prologue
    .line 23
    const-string v0, "mt.c.3g.163.com"

    const/16 v1, 0x138b

    invoke-direct {p0, v0, v1}, Lcom/netease/mobistat/client/clients/BaseClient;-><init>(Ljava/lang/String;I)V

    .line 24
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;I)V
    .locals 0
    .parameter "server"
    .parameter "port"

    .prologue
    .line 27
    invoke-direct {p0, p1, p2}, Lcom/netease/mobistat/client/clients/BaseClient;-><init>(Ljava/lang/String;I)V

    .line 28
    return-void
.end method

.method public static main([Ljava/lang/String;)V
    .locals 2
    .parameter "args"

    .prologue
    .line 58
    new-instance v0, Lcom/netease/mobistat/client/clients/StatClient;

    invoke-direct {v0}, Lcom/netease/mobistat/client/clients/StatClient;-><init>()V

    .line 59
    .local v0, sClient:Lcom/netease/mobistat/client/clients/StatClient;
    const-string v1, "abac"

    invoke-static {v1}, Lcom/netease/mobistat/util/Constant;->setStatinfo(Ljava/lang/String;)V

    .line 60
    invoke-virtual {v0}, Lcom/netease/mobistat/client/clients/StatClient;->run()V

    .line 61
    return-void
.end method


# virtual methods
.method public run()V
    .locals 6

    .prologue
    const/4 v5, 0x1

    .line 33
    new-instance v0, Lorg/jboss/netty/bootstrap/ClientBootstrap;

    new-instance v2, Lorg/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory;

    .line 34
    invoke-static {}, Ljava/util/concurrent/Executors;->newCachedThreadPool()Ljava/util/concurrent/ExecutorService;

    move-result-object v3

    invoke-static {}, Ljava/util/concurrent/Executors;->newCachedThreadPool()Ljava/util/concurrent/ExecutorService;

    move-result-object v4

    invoke-direct {v2, v3, v4}, Lorg/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory;-><init>(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)V

    .line 33
    invoke-direct {v0, v2}, Lorg/jboss/netty/bootstrap/ClientBootstrap;-><init>(Lorg/jboss/netty/channel/ChannelFactory;)V

    .line 37
    .local v0, bootstrap:Lorg/jboss/netty/bootstrap/ClientBootstrap;
    iget v2, p0, Lcom/netease/mobistat/client/clients/StatClient;->port:I

    invoke-static {v2}, Lcom/netease/mobistat/client/pipeline/PipelineFactoryFactory;->createPipelineFactory(I)Lorg/jboss/netty/channel/ChannelPipelineFactory;

    move-result-object v2

    invoke-virtual {v0, v2}, Lorg/jboss/netty/bootstrap/ClientBootstrap;->setPipelineFactory(Lorg/jboss/netty/channel/ChannelPipelineFactory;)V

    .line 38
    const-string v2, "tcpNoDelay"

    invoke-static {v5}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v3

    invoke-virtual {v0, v2, v3}, Lorg/jboss/netty/bootstrap/ClientBootstrap;->setOption(Ljava/lang/String;Ljava/lang/Object;)V

    .line 39
    const-string v2, "keepAlive"

    invoke-static {v5}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v3

    invoke-virtual {v0, v2, v3}, Lorg/jboss/netty/bootstrap/ClientBootstrap;->setOption(Ljava/lang/String;Ljava/lang/Object;)V

    .line 42
    new-instance v2, Ljava/net/InetSocketAddress;

    iget-object v3, p0, Lcom/netease/mobistat/client/clients/StatClient;->server:Ljava/lang/String;

    iget v4, p0, Lcom/netease/mobistat/client/clients/StatClient;->port:I

    invoke-direct {v2, v3, v4}, Ljava/net/InetSocketAddress;-><init>(Ljava/lang/String;I)V

    invoke-virtual {v0, v2}, Lorg/jboss/netty/bootstrap/ClientBootstrap;->connect(Ljava/net/SocketAddress;)Lorg/jboss/netty/channel/ChannelFuture;

    move-result-object v1

    .line 45
    .local v1, future:Lorg/jboss/netty/channel/ChannelFuture;
    invoke-interface {v1}, Lorg/jboss/netty/channel/ChannelFuture;->awaitUninterruptibly()Lorg/jboss/netty/channel/ChannelFuture;

    move-result-object v2

    invoke-interface {v2}, Lorg/jboss/netty/channel/ChannelFuture;->getChannel()Lorg/jboss/netty/channel/Channel;

    move-result-object v2

    iput-object v2, p0, Lcom/netease/mobistat/client/clients/StatClient;->channel:Lorg/jboss/netty/channel/Channel;

    .line 46
    invoke-interface {v1}, Lorg/jboss/netty/channel/ChannelFuture;->isSuccess()Z

    move-result v2

    if-nez v2, :cond_0

    .line 47
    invoke-interface {v1}, Lorg/jboss/netty/channel/ChannelFuture;->getCause()Ljava/lang/Throwable;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/Throwable;->printStackTrace()V

    .line 48
    invoke-virtual {v0}, Lorg/jboss/netty/bootstrap/ClientBootstrap;->releaseExternalResources()V

    .line 55
    :goto_0
    return-void

    .line 53
    :cond_0
    iget-object v2, p0, Lcom/netease/mobistat/client/clients/StatClient;->channel:Lorg/jboss/netty/channel/Channel;

    invoke-interface {v2}, Lorg/jboss/netty/channel/Channel;->getCloseFuture()Lorg/jboss/netty/channel/ChannelFuture;

    move-result-object v2

    invoke-interface {v2}, Lorg/jboss/netty/channel/ChannelFuture;->awaitUninterruptibly()Lorg/jboss/netty/channel/ChannelFuture;

    .line 54
    invoke-virtual {v0}, Lorg/jboss/netty/bootstrap/ClientBootstrap;->releaseExternalResources()V

    goto :goto_0
.end method
